using System;
using System.Collections.Generic;
using System.Text;
using System.Xml;
using Dracham.Classes;
using Dracham.Network;

namespace Dracham.TileManagement.ZoneManagement.Actions
{
    public class Teleport:Action
    {
        private Int32 x;
        private Int32 y;
        private String zoneId;

        public Teleport(XmlNode node)
        {
            x = Convert.ToInt32(node.Attributes["X"].Value);
            y = Convert.ToInt32(node.Attributes["Y"].Value);
            zoneId = node.Attributes["Zone"].Value;
        }

        public override void RunAction()
        {
            Dracham.Player.Position = new Position(x, y, zoneId);

            //
            // send character movement 
            Dracham.DrachamNetwork.Invoke(RequestType.CharacterMovement,
                        new NetworkParameter(Dracham.SessionKey, 36),
                        new NetworkParameter(zoneId, 20),
                        new NetworkParameter(x, 5),
                        new NetworkParameter(y, 5));
        }
    }
}
